#ifndef CIOWORK_H
#define CIOWORK_H

#include <QObject>
#include <QThread>
#include "cserial.h"
#include <QFuture>
#include <QString>

class CIoWork : public QObject
{
    Q_OBJECT
    Q_PROPERTY(QString data READ read WRITE write NOTIFY sigDataChanged)

private:
    CSerial m_serial;
    QString m_readData;
    QString m_writeCommand;
    QFuture<void> m_readThread;

public:
    CIoWork(QObject *parent = 0);
    virtual ~CIoWork();

signals:
    QString sigDataChanged();

public:
    QString read();


public slots:
    void write(QString szData);
    void close();

public:
    static void readSerial(CIoWork *io);

};

#endif // CIOWORK_H
